// Copyright Up and Running
.directive('bstopSearchTerm', function ($compile) {
return {
restrict: 'A',
replace: true,
scope: {
data: '=',
mask: '='
},
link: function (scope, elm, attrs) {
elm.html(scope.mask);
$compile(elm.contents())(scope);
elm.replaceWith(elm.contents());
}
}
})
.directive('bstopSearchTree', function () {
return {
restrict: 'A',
controller: function ($scope) {
$scope.getCurrentSearch();
},
template: '
NOT
' +
'' +
'' +
'
' +
'
' +
'' +
'' +
'
' +
'
'
}
})
.directive('bstopLogicOperator', function () {
return {
restrict: 'A',
scope: {
operator: '=',
hide: '=',
father: '='
},
link: function (scope, elm, attrs) {
scope.switchOperator = function () {
var operator = '';
if (scope.operator == 'AND') {
operator = 'OR';
} else {
operator = 'AND';
}
if (scope.father && scope.father.data && scope.father.data.nodes) { // For branches
angular.forEach(scope.father.data.nodes, function (value, index) {
scope.father.data.nodes[index].operator = operator;
});
} else if (scope.father && scope.father.nodes) { // For the root
angular.forEach(scope.father.nodes, function (value, index) {
scope.father.nodes[index].operator = operator;
});
}
}
},
template: ''
}
})